package gl.android.biyiqing.bean;

import org.json.JSONException;
import org.json.JSONObject;

public class Result {

	public String data;
	private String act;
	private String msg;

	public static Result parse(String s) throws JSONException,
			NullPointerException {
		Result result = new Result();
		result.setAct(new JSONObject(s).getString("act"));
		result.setMsg(new JSONObject(s).getString("msg"));
		result.setData(new JSONObject(s).opt("data") == null ? ""
				: new JSONObject(s).get("data").toString());
		return result;

	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	/**
	 * 
	 * @return The act
	 */
	public String getAct() {
		return act;
	}

	/**
	 * 
	 * @param act
	 *            The act
	 */
	public void setAct(String act) {
		this.act = act;
	}

	/**
	 * 
	 * @return The msg
	 */
	public String getMsg() {
		return msg;
	}

	/**
	 * 
	 * @param msg
	 *            The msg
	 */
	public void setMsg(String msg) {
		this.msg = msg;
	}

	public boolean isValue() {

		return data != null;
	}

}